import { createRouter, createWebHistory } from 'vue-router'
import home from '../views/home/index.vue' // 引入组件

const routes = [
  {
    path: '/',
    name: 'home',
    components: {
      default: home,
      footer: () => import(/* webpackChunkName: "about" */ '../components/Footer.vue')
    }
  },
  {
    path: '/kind',
    name: 'kind',
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/kind/index.vue'),
      footer: () => import(/* webpackChunkName: "about" */ '../components/Footer.vue')
    }
  },
  {
    path: '/cart',
    name: 'cart',
    // component: () => import(/* webpackChunkName: "about" */ '../views/cart/index.vue')
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/cart/index.vue'),
      footer: () => import(/* webpackChunkName: "about" */ '../components/Footer.vue')
    }
  },
  {
    path: '/user',
    name: 'user',
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/user/index.vue'),
      footer: () => import(/* webpackChunkName: "about" */ '../components/Footer.vue')
    }
  },
  {
    path: '/detail/:id',
    name: 'detail',
    component: () => import(/* webpackChunkName: "about" */ '../views/detail/index.vue')
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
